package com.citywithincity.db.drivers.oracle;

import com.citywithincity.db.ArFactory;
import com.citywithincity.db.ArFactoryImpl;
import com.citywithincity.db.ConnectionDescription;
import com.citywithincity.db.interfaces.IDataSourceProvider;
import com.citywithincity.db.interfaces.SqlDriver;
import com.citywithincity.db.meta.DbStructFactory;
import com.citywithincity.db.meta.impl.oracle.OracleDbStruct;

public class OracleConnDescription extends ConnectionDescription {

	private DbStructFactory struct;
	private String jdbcUrl;
	
	private OracleConnDescription(String jdbcUrl, String user, String password) {
		setDriverClass("oracle.jdbc.driver.OracleDriver");
		setUser(user);
		setPassword(password);
		this.setJdbcUrl(jdbcUrl);
		
	}
	
	public OracleConnDescription(String server,int port,String db,String user,String password){
		this("jdbc:oracle:thin:@"+server+":"+port+":"+db, user, password);
		
	}
	public OracleConnDescription(String server,String db,String user,String password){
		this("jdbc:oracle:thin:@"+server+":1521:"+db, user, password);
	}

	@Override
	public ArFactory create(IDataSourceProvider ds) {
		return new ArFactoryImpl(this,ds);
	}

	@Override
	protected SqlDriver createDriver() {
		return new OracleDriver();
	}

	

	public String getJdbcUrl() {
		return jdbcUrl;
	}

	public void setJdbcUrl(String jdbcUrl) {
		this.jdbcUrl = jdbcUrl;
	}

	@Override
	protected DbStructFactory createStruct(SqlDriver sqlDriver) {
		return new OracleDbStruct(sqlDriver, getUser());
	}

	
	
	
}
